/********************************************************************************
 *      Copyright:  (C) HuangXiangming
 *                  All rights reserved.
 *
 *       Filename:  socket_reconnect.h
 *    Description:  This file is about client connect function 
 *
 *        Version:  1.0.0(25/04/03)
 *         Author:  Huang Xiangming <huangxiangming@gmail.com>
 *      ChangeLog:  1, Release initial version on "25/04/03 18:21:00"
 *                 
 ********************************************************************************/
#ifndef SOCKET_H
#define SOCKET_H
//socket结构体
typedef struct socket_s
{
	int			fd;
	int			port;
	char        hostname[64];
	int         connected;
}socket_t;

//socket初始化
int socket_init(socket_t *sock, char *hostname, int port);

//socket连接
int socket_connect(socket_t *sock);

//关闭
int socket_close(socket_t *sock);

//fd查询
int socket_diag(socket_t *sock);

//读
int socket_read(socket_t *sock);

//写
int socket_write(socket_t *sock, char *data, int len);

#endif
